summaryrefslogtreecommitdiff
path: root/app/[lng]/evcp/(evcp)/general-contracts/[id]/page.tsx
diff options
context:
space:
mode:
Diffstat (limited to 'app/[lng]/evcp/(evcp)/general-contracts/[id]/page.tsx')
-rw-r--r--app/[lng]/evcp/(evcp)/general-contracts/[id]/page.tsx70
1 files changed, 70 insertions, 0 deletions
diff --git a/app/[lng]/evcp/(evcp)/general-contracts/[id]/page.tsx b/app/[lng]/evcp/(evcp)/general-contracts/[id]/page.tsx
new file mode 100644
index 00000000..632f7145
--- /dev/null
+++ b/app/[lng]/evcp/(evcp)/general-contracts/[id]/page.tsx
@@ -0,0 +1,70 @@
+import { redirect, notFound } from 'next/navigation'
+import { Shell } from "@/components/shell"
+import { getContractById } from "@/lib/general-contracts/service"
+import ContractDetailPage from "@/lib/general-contracts/detail/general-contract-detail"
+
+interface PageProps {
+ params: Promise<{ lng: string; id: string }>
+}
+
+export async function generateMetadata({ params }: PageProps) {
+ const { id } = await params
+
+ // ID 유효성 검사
+ if (!id || isNaN(parseInt(id))) {
+ return {
+ title: "계약 상세",
+ description: "일반계약 상세 정보",
+ }
+ }
+
+ try {
+ const contractId = parseInt(id)
+ const contract = await getContractById(contractId)
+
+ if (!contract) {
+ return {
+ title: "계약을 찾을 수 없습니다",
+ description: "요청하신 계약을 찾을 수 없습니다.",
+ }
+ }
+
+ return {
+ title: `계약 상세 - ${contract.name}`,
+ description: `계약번호: ${contract.contractNumber} (Rev.${contract.revision})`,
+ }
+ } catch {
+ return {
+ title: "계약 상세",
+ description: "일반계약 상세 정보",
+ }
+ }
+}
+
+export default async function Page({ params }: PageProps) {
+ const { lng, id } = await params
+
+ // ID 유효성 검사
+ const contractId = parseInt(id)
+ if (isNaN(contractId) || contractId <= 0) {
+ notFound()
+ }
+
+ try {
+ // 계약 정보 사전 로드
+ const contract = await getContractById(contractId)
+
+ if (!contract) {
+ notFound()
+ }
+
+ return (
+ <Shell className="gap-4">
+ <ContractDetailPage />
+ </Shell>
+ )
+ } catch (error) {
+ console.error("Error loading contract:", error)
+ notFound()
+ }
+}